package com.tengju.data.infrastructure.persistence.mybatis.mapper.tengju.custom;

import com.tengju.data.infrastructure.persistence.mybatis.dataobject.AchievementBonusDO;
import com.tengju.data.infrastructure.persistence.mybatis.dataobject.AchievementBonusSumDO;
import com.tengju.data.infrastructure.persistence.mybatis.dataobject.UserBonusResultDO;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

public interface AchievementBonusDOCustomMapper {

    void saveAchievementBonusLog(@Param("month") Integer month, @Param("logTime") LocalDateTime logTime);

    void batchReplaceInsert(@Param("achievementBonusDOList") List<AchievementBonusDO> achievementBonusDOList);

    List<AchievementBonusDO> queryByMonth(@Param("idCode") Long idCode,@Param("month") Integer month);

    int getMaxVersion();

    void deleteInvalidData(@Param("month") Integer month, @Param("version") Integer version);

    List<AchievementBonusSumDO> sumByYear(@Param("idCode") Long idCode,
                                          @Param("startMonth") Integer startMonth,
                                          @Param("endMonth") Integer endMonth);

    List<AchievementBonusSumDO> getAchievementByYear(@Param("idCode") Long idCode,
                                                     @Param("startMonth")Integer startMonth,
                                                     @Param("endMonth")Integer endMonth);

    List<Map<String,Object>> getAchievementByTeamRatioType(@Param("idCode")Long idCode,
                                            @Param("month")Integer month);

    List<AchievementBonusDO> queryChildByMonth(@Param("idCode") Long idCode,@Param("month") Integer month);

    BigDecimal getBonus(@Param("idCode") Long idCode, @Param("status") Integer status, @Param("month") Integer month);

    int countMarketBonusUser(@Param("month") Integer month);

    List<UserBonusResultDO> listMarketBonus(@Param("month") Integer month, @Param("status") byte status, @Param("idCodes") List<Long> idCodes);

    void updateBonusStatus(@Param("idCode") Long idCode, @Param("month") Integer month, @Param("curStatus") byte curStatus, @Param("targetStatus") byte targetStatus);

    List<Long> listBonusSettleUser(@Param("month") Integer month, @Param("offset") Integer offset, @Param("limit") Integer limit);

    List<AchievementBonusDO> listByIdCodesAndMonth(@Param("month") Integer month, @Param("idCodeList") List<Long> idCodeList);

    List<UserBonusResultDO> listAllMarketBonus(@Param("month") Integer month, @Param("status") byte status, @Param("idCodes") List<Long> idCodes);
}